package org.jeecg.modules.maps.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.modules.maps.entity.BimMapsInfo;
import org.jeecg.modules.maps.service.IBimMapsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


//@Api(tags = "贴图详情")
@RestController
@RequestMapping("/geo/bimMapsInfo")
public class BimMapsInfoController {

    @Autowired
    private IBimMapsInfoService bimMapsInfoService;


    /**
     * 列表查询
     *
     * @param mapsId
     * @return
     */
    //@ApiOperation(value = "贴图详情列表查询", notes = "贴图详情列表查询")
    @GetMapping(value = "/list")
    public Result<List<BimMapsInfo>> queryPageList(@RequestParam(name = "mapsId") @ApiParam(value = "贴图id") Integer mapsId) {
        List<BimMapsInfo> bimMapsInfos = bimMapsInfoService.mapsInfoList(mapsId);
        return Result.OK(bimMapsInfos);
    }



    /**
     * 编辑
     *
     * @param bimMapsInfo
     * @return
     */
    @AutoLog(value = "贴图详情编辑")
    //@ApiOperation(value = "贴图详情编辑", notes = "贴图详情编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<String> edit(@RequestBody @ApiParam BimMapsInfo bimMapsInfo) {
        bimMapsInfoService.addMapsInfo(bimMapsInfo);
        return Result.OK("编辑成功!");
    }


    /**
     * 编辑
     *
     * @param
     * @return
     */
    @AutoLog(value = "贴图详情删除")
    //@ApiOperation(value = "贴图详情删除", notes = "贴图详情删除")
    @DeleteMapping(value = "/delete")
    public Result<String> delMapsInfoImg( @ApiParam("贴图详情id") Integer id) {
        bimMapsInfoService.removeById(id);
        return Result.OK("删除成功!");
    }
}
